home *** CD-ROM | disk | FTP | other *** search
/ Just Call Me Internet / Just Call Me Internet.iso / prog / atari / c / ltick03 / config.c < prev    next >
C/C++ Source or Header  |  1993-06-07  |  21KB  |  865 lines

  1. /*
  2.  *    Configuration file manager (tb.cfg)
  3.  *    (LazyTick/LazyFix Project; based on Bermuda code)
  4.  *   
  5.  *    Public Domain: may be copied and sold freely
  6.  */
  7.  
  8. #include    <stdio.h>
  9. #include    <stdlib.h>
  10. #include    <time.h>
  11. #include    <portab.h>
  12. #include    <ctype.h>
  13. #include    <string.h>
  14.  
  15. #include    "tick.h"
  16. #include    "misc.h"
  17. #include    "config.h"
  18.  
  19. /* open_config: load the config file
  20.    close_config: close the config file
  21.    debug_config: display the config file
  22.    get_announce: get announce list
  23.    get_out_fname: get outbound hold file nale
  24.    get_password: get password for a node
  25.    get_ouraddress: get ouraka 
  26.    get_sysop: get sysop name
  27.    get_inbound: get in dir
  28.    get_outbound: get out dir
  29.    get_ticktemp: get tick dir */
  30.  
  31. /* ===================================================== GLOBAL VARS */
  32.  
  33. BPASSWORD *cfg_pwd;
  34. BAKA alias[30];      /* aliases */
  35. int  nalias=0;              /* number of aliases */
  36. BTCKANN *cfg_announce=NULL;
  37. BFIXPERM *cfg_perms=NULL;
  38. BFIXPERM *cfg_fperms=NULL;
  39. char cfg_temp[BBSSTR];
  40. char cfg_sysop[BBSSTR];
  41. char cfg_mailpath[BBSSTR];
  42. char cfg_netpath[BBSSTR];
  43. char cfg_holdbink[BBSSTR];
  44. char cfg_hold[BBSSTR];
  45. int     cfg_binkley=0;
  46.  
  47.  
  48. /* ==================================================== LOAD CONFIG */
  49.  
  50. void close_config(void )
  51. {
  52.     close_the_log();
  53. }
  54.  
  55. void debug_config(void )
  56. {
  57.     int i;
  58.     BPASSWORD *pw;
  59.     BTCKANN *tica;
  60.     BFIXPERM *fica;
  61.     
  62.     printf("Inbound : %s\n",get_inbound());
  63.     printf("Hold    : %s\n",get_outbound());
  64.     printf("Sysop   : %s\n",get_sysop());
  65.     printf("Temp    : %s\n",get_ticktemp());
  66.  
  67.     for(i=0;i<nalias;i++)
  68.     {
  69.         printf("address %d:%d/%d.%d\n",alias[i].zone,
  70.             alias[i].net,alias[i].node,
  71.             alias[i].point);
  72.     }
  73.     
  74.     pw=cfg_pwd->next;
  75.     while (pw!=NULL)
  76.     {
  77.         printf("key %d:%d/%d.%d password: %s aka: %d\n",
  78.             pw->zone,pw->net,pw->node,pw->point,
  79.             pw->passw,
  80.             pw->my_aka);
  81.         pw=pw->next;
  82.     }
  83.     
  84.     tica=cfg_announce;
  85.     while(tica)
  86.     {
  87.         printf("announce group %s in %s with footer %s\n",
  88.             tica->group,tica->area,tica->footer[0] ? tica->footer : "-none-");
  89.         tica=tica->next;
  90.     }
  91.     
  92.     fica=cfg_perms;
  93.     while(fica)
  94.     {
  95.         printf("Areafix permissions for group %s: nodes %s.\n", 
  96.             fica->group, fica->nodes);
  97.         fica=fica->next;
  98.     }
  99.     
  100.     fica=cfg_fperms;
  101.     while(fica)
  102.     {
  103.         printf("Filefix permissions for group %s: nodes %s.\n", 
  104.             fica->group, fica->nodes);
  105.         fica=fica->next;
  106.     }
  107. }
  108.    
  109. int open_config(void )
  110. {
  111.     FILE *conf;                     /* filepointer for config-file */
  112.     char buffer[BBSSTR];            /* buffer for 1 line */
  113.     char Bpath[BBSSTR];
  114.     char logname[BBSSTR];
  115.     char *p;                        /* workhorse */
  116.     int count;                      /* just a counter... */
  117.     int loglevel=2;
  118.  
  119.     /* zerostr */
  120.     cfg_netpath[0]=0;
  121.     cfg_sysop[0]=0;
  122.     cfg_mailpath[0]=0;
  123.     cfg_temp[0]=0;
  124.     cfg_hold[0]=0;
  125.     cfg_holdbink[0]=0;
  126.         
  127.     /* init */
  128.     Bpath[0]=0;
  129.     cfg_pwd= (struct _passw *) malloc(sizeof(struct _passw));
  130.     if(!cfg_pwd)
  131.     {
  132.         logline(5,"Can't malloc pwd!");
  133.         the_end(242);
  134.     }
  135.     cfg_pwd->zone=cfg_pwd->net=cfg_pwd->node=cfg_pwd->point=0;
  136.     cfg_pwd->next=NULL;
  137.     
  138. #ifdef OLDCODE /* mailer env var, change ffirst */    
  139.     p=getenv("MAILER");
  140.     if (!ffirst("bermuda.cfg") &&      /* check local config */
  141.         !ffirst("tb.cfg") &&
  142.         p!=NULL && *p!='\0')
  143.     {                                  /* no local, and envi contained one */
  144.         strcpy(Bpath,p);
  145.         addslash(Bpath);
  146.     }
  147. #endif
  148.  
  149.     sprintf( buffer, "%s%s", Bpath,BERMCFG1);
  150.     conf= fopen(buffer, "r");
  151.  
  152.     if (conf==NULL)
  153.     {
  154.         sprintf(buffer,"%s%s", Bpath,BERMCFG2);
  155.  
  156.         conf = fopen(buffer, "r");
  157.     }
  158.  
  159. #ifdef DEBUG
  160.     printf("Config: %s\n",buffer);
  161. #endif
  162.  
  163.     if (conf==NULL)
  164.     {
  165.         logline(5,"Configuration file not found, please check!");
  166.         return BBSFAIL;                           /* not found, back */
  167.     }
  168.  
  169.     /* set all to default values */
  170.  
  171.     logline(0,"Parsing configuration file");
  172.        
  173.     while((fgets(buffer, BBSSTR-2, conf)))       /* read a line */
  174.     {
  175. #ifdef DEBUG
  176.         printf("Config: %s\n",buffer);
  177. #endif
  178.  
  179.         p=skip_blanks(buffer);
  180.         if (*p==';') continue;               /* comment?? */
  181.  
  182.         /* delete ALL chars following (and inclusive) comment sign */
  183.         if ((p=strchr(buffer,';'))!=NULL)  *p= '\0';
  184.         if ((count= (int)strlen(buffer))<3) continue;
  185.                                             /* what's the length of the rest? */
  186.         p= &buffer[--count];
  187.         if (*p=='\n') *p=0;                 /* delete (possible) newline char */
  188.  
  189.         /* process "application bermuda" and 
  190.             "application lazytick" lines as normal lines */
  191.         if (!strnicmp(buffer,"application",11))
  192.         {
  193.             p=skip_blanks(&buffer[11]);
  194.             if(!strnicmp(p,"bermuda",7)) {
  195.                 p=skip_blanks(&p[7]);
  196.                 strcpy(buffer,p);
  197.             }
  198.             if(!strnicmp(p,"lazyfix",7)) {
  199.                 p=skip_blanks(&p[7]);
  200.                 strcpy(buffer,p);
  201.             }
  202.             if(!strnicmp(p,"lazytick",8)) {
  203.                 p=skip_blanks(&p[8]);
  204.                 strcpy(buffer,p);
  205.             }
  206.         }
  207.  
  208.         if (!strnicmp(buffer,"sysop",5))
  209.         {
  210.                 p=skip_blanks(&buffer[5]);
  211.                 strncpy(cfg_sysop,p,BBSSTR-10);
  212.                 cfg_sysop[BBSSTR-10]='\0';
  213.                 continue;
  214.         }
  215.  
  216.         if (!strnicmp(buffer,"address",7))
  217.         {
  218.             p=skip_blanks(&buffer[7]);
  219.             if(getaddress(p,&alias[nalias].zone, &alias[nalias].net,
  220.                 &alias[nalias].node, &alias[nalias].point)!=7)
  221.             {
  222.                logline(3,"Invalid address in %s",buffer);
  223.                continue;
  224.             }
  225.             p=skip_blanks(skip_to_blank(p));
  226.  
  227.             if (*p=='+' || *p=='*') p=skip_blanks(skip_to_blank(p));
  228.  
  229.             if (*p && isdigit(*p))            
  230.             {
  231.                 if ((alias[nalias].pointnet=atoi(p))==0)
  232.                 {
  233.                    logline(5,"Invalid pointnet in %s",buffer);
  234.                    continue;
  235.                 }
  236.             }
  237.             else 
  238.                 alias[nalias].pointnet=0;
  239.             ++nalias;
  240.  
  241.             continue;
  242.         }
  243.  
  244.         if (!strnicmp(buffer,"loglevel",8))
  245.         {
  246.             p=skip_blanks(&buffer[8]);
  247.             if (sscanf(p,"%d", &count)!=1 || count>5 || count<0)
  248.                 logline(3,"Invalid loglevel (%s)", p);
  249.             else 
  250.                 loglevel=count;
  251.             continue;
  252.         }
  253.  
  254.         if (!strnicmp(buffer, "statuslog",9))
  255.         {
  256.             ctl_string(logname,&buffer[9]);            
  257.             continue;
  258.         }
  259.  
  260.         if (!strnicmp(buffer,"netfile",7))
  261.         {
  262.             ctl_path(cfg_mailpath,&buffer[7]);
  263.             continue;
  264.         }
  265.         
  266.         if (!strnicmp(buffer,"ticktemp",8))
  267.         {
  268.             ctl_path(cfg_temp,&buffer[8]);
  269.             continue;
  270.         }
  271.         
  272.         if (!strnicmp(buffer,"tickann",7))
  273.         {
  274.             char *ptr;
  275.             BTCKANN workst,*annptr;
  276.             
  277.             ptr=nextstr(buffer);
  278.             if(ptr)
  279.             {
  280.                 strspacecpy(workst.area,ptr);
  281.                 ptr=nextstr(ptr);
  282.                 if(ptr)
  283.                 {
  284.                     strspacecpy(workst.group,ptr);
  285.                     ptr=nextstr(ptr);
  286.                     if(ptr)
  287.                         strspacecpy(workst.footer,ptr);
  288.                     else
  289.                         workst.footer[0]=0;
  290.                     
  291.                     /* ok we got it */
  292.                      annptr=cfg_announce;
  293.                      if(annptr==NULL) /* first one */
  294.                          annptr=cfg_announce=malloc(sizeof(struct _ticann));
  295.                      else
  296.                      {
  297.                          while(annptr->next)
  298.                              annptr=annptr->next;
  299.                          annptr->next=malloc(sizeof(struct _ticann));
  300.                          annptr=annptr->next;
  301.                          
  302.                      }    
  303.                      if(!annptr)
  304.                      {
  305.                          logline(5,"Malloc error in cfg");
  306.                          the_end(242);
  307.                      }
  308.                      annptr->next=NULL;
  309.                      strcpy(annptr->area,workst.area);
  310.                      strcpy(annptr->group,workst.group);
  311.                      strcpy(annptr->footer,workst.footer);
  312.                 }
  313.             }
  314.             continue;
  315.         }
  316.         
  317.         if (!strnicmp(buffer,"afixperm",8)) /* areafix permissions */
  318.         {
  319.             char *ptr;
  320.             BFIXPERM workst,*annptr;
  321.             
  322.             ptr=nextstr(buffer);
  323.             if(ptr)
  324.             {
  325.                 strspacecpy(workst.group,ptr);
  326.                 ptr=nextstr(ptr);
  327.                 if(ptr)
  328.                 {
  329.                     strspacecpy(workst.nodes,ptr);
  330.                     
  331.                     /* ok we got it */
  332.                      annptr=cfg_perms;
  333.                      if(annptr==NULL) /* first one */
  334.                          annptr=cfg_perms=malloc(sizeof(struct _fixperm));
  335.                      else
  336.                      {
  337.                          while(annptr->next)
  338.                              annptr=annptr->next;
  339.                          annptr->next=malloc(sizeof(struct _fixperm));
  340.                          annptr=annptr->next;
  341.                          
  342.                      }    
  343.                      if(!annptr)
  344.                      {
  345.                          logline(5,"Malloc error in cfg");
  346.                          the_end(242);
  347.                      }
  348.                      annptr->next=NULL;
  349.                      strcpy(annptr->group,workst.group);
  350.                      strcpy(annptr->nodes,workst.nodes);
  351.                 }
  352.             }
  353.             continue;
  354.         }
  355.         
  356.         if (!strnicmp(buffer,"ffixperm",8)) /* filefix perissions */
  357.         {
  358.             char *ptr;
  359.             BFIXPERM workst,*annptr;
  360.             
  361.             ptr=nextstr(buffer);
  362.             if(ptr)
  363.             {
  364.                 strspacecpy(workst.group,ptr);
  365.                 ptr=nextstr(ptr);
  366.                 if(ptr)
  367.                 {
  368.                     strspacecpy(workst.nodes,ptr);
  369.                     
  370.                     /* ok we got it */
  371.                      annptr=cfg_fperms;
  372.                      if(annptr==NULL) /* first one */
  373.                          annptr=cfg_fperms=malloc(sizeof(struct _fixperm));
  374.                      else
  375.                      {
  376.                          while(annptr->next)
  377.                              annptr=annptr->next;
  378.                          annptr->next=malloc(sizeof(struct _fixperm));
  379.                          annptr=annptr->next;
  380.                          
  381.                      }    
  382.                      if(!annptr)
  383.                      {
  384.                          logline(5,"Malloc error in cfg");
  385.                          the_end(242);
  386.                      }
  387.                      annptr->next=NULL;
  388.                      strcpy(annptr->group,workst.group);
  389.                      strcpy(annptr->nodes,workst.nodes);
  390.                 }
  391.             }
  392.             continue;
  393.         }
  394.         
  395.         if (!strnicmp(buffer,"netmail",7))
  396.         {
  397.             ctl_string(cfg_netpath,&buffer[7]);
  398.             continue;
  399.         }
  400.  
  401.         if (!strnicmp(buffer,"hold",4))
  402.         {
  403.             ctl_path(cfg_hold,&buffer[4]);
  404.             strcpy(cfg_holdbink,cfg_hold); 
  405.             cfg_holdbink[strlen(cfg_holdbink)-1]=0;
  406.             continue;
  407.         }
  408.  
  409.         if (!strnicmp(buffer,"key",3))
  410.         {
  411.             parsekey(&buffer[3]);
  412.             continue;
  413.         }
  414.  
  415.         if (!strnicmp(buffer,"binkley", 7))
  416.         {
  417.             cfg_binkley=1;
  418.             continue;
  419.         }
  420.     }
  421.     
  422.     fclose(conf);
  423.     
  424.     /* open the logfile */
  425.     if(open_the_log(logname,loglevel)==BBSFAIL)
  426.            logline(5,"Can't open logfile %s",logname);
  427.     
  428.     return BBSOK;                           /* signal OK */
  429. }
  430.  
  431. /* parse the key line */
  432.  
  433. void parsekey(char *p)
  434. {
  435.     int i;
  436.     char password[9];
  437.     BPASSWORD *pw,*pn;
  438.     int zone,net,node,point;
  439.     int my_aka=0;
  440.     
  441.     /* get to the end of the list. */
  442.     pw=cfg_pwd;
  443.  
  444.     while (pw->next!=NULL)      pw=pw->next;
  445.  
  446.     password[0]='\0';
  447.     
  448.     p=skip_blanks(p);
  449.     while (*p && *p!=';')
  450.     {
  451.         if (*p=='!')
  452.         {
  453.             strncpy(password,p+1,7);
  454.             for (i=0; i<7; ++i)
  455.             {
  456.                 if (isspace(password[i])) break;
  457.             }
  458.             password[i]='\0';
  459.  
  460.             /* skip password and go on to node(s) */
  461.             p=skip_to_blank(p);
  462.             p=skip_blanks(p);
  463.             continue;
  464.         }
  465.  
  466.         if (*p=='#')
  467.         {
  468.             if (getaddress(p+1,&zone,&net,&node,&point))
  469.             {
  470.                 int found=0;
  471.                 for (i=0; i<nalias; i++)
  472.                 {
  473.                     if (alias[i].zone==zone && alias[i].net==net &&
  474.                         alias[i].node==node && alias[i].point==point)
  475.                     {
  476.                         found++;
  477.                         break;
  478.                     }
  479.                 }
  480.                 if (found) my_aka=i;
  481.                 else
  482.                 {
  483.                     my_aka=0;
  484.                     logline(3,"Address %d:%d/%d.%d used in key is unknown",
  485.                      zone,net,node,point);
  486.                 }
  487.             }
  488.  
  489.             p= skip_to_blank(p);
  490.             p= skip_blanks(p);
  491.             continue;
  492.         }
  493.  
  494.         pn=pw->next= (struct _passw *) malloc(sizeof(struct _passw));
  495.         if(!pw)
  496.         {
  497.             logline(5,"Malloc error in config");
  498.             the_end(242);
  499.         }
  500.  
  501.         if (!getaddress(p,&zone,&net,&node,&point))
  502.         {
  503.             free(pn);
  504.             pw->next=NULL;
  505.             logline(3,"-Invalid address: %s",p);
  506.             return;
  507.         }
  508.  
  509.         if (point)
  510.         {
  511.             for (i=0; i < nalias; i++)
  512.             {
  513.                 if (alias[i].zone==zone && alias[i].net==net &&
  514.                     alias[i].node==node)
  515.                 {
  516.                     net= alias[i].pointnet;
  517.                     node= point;
  518.                     point= 0;
  519.                     break;
  520.                 }
  521.             }
  522.         }
  523.         pn->zone=zone;
  524.         pn->net=net;
  525.         pn->node=node;
  526.         pn->point=point;
  527.         pn->my_aka=my_aka;
  528.         strcpy(pn->passw,password);
  529.         p=skip_to_blank(p);
  530.         p=skip_blanks(p);
  531.         pw=pn;
  532.         pw->next=NULL;
  533.     }
  534.     
  535.     return;
  536. }
  537.  
  538. int getint(p,i)                                   /* Mind the calling parms! */
  539. char **p;
  540. int *i;
  541. {
  542.         char *q;
  543.         long temp;
  544.  
  545.         q=*p;
  546.         if (!isdigit(*q)) return (-1);
  547.  
  548.         temp=0;
  549.         do {
  550.            temp*=10;
  551.            temp+=(*q++-'0');
  552.            } while (isdigit(*q));
  553.         *p=q;
  554.         *i=(int)temp;
  555.         if (temp>32767) return (-1);
  556.         return (0);
  557. }
  558.  
  559. int getaddress(str, zone, net, node, point)     /* Decode zz:nn/mm.pp number */
  560. char *str;       /* 0=error | 1=node | 2=net/node | 3=zone:net/node | 4=pnt */
  561. int *zone, *net, *node, *point;
  562. {
  563.         int retcode=0;
  564.  
  565.         *zone  = alias[0].zone;
  566.         *net   = alias[0].net;
  567.         *node  = alias[0].node;
  568.         *point = 0;
  569.  
  570.         str=skip_blanks(str);
  571.  
  572.         if (*str=='.') goto pnt;
  573.         retcode++;
  574.         if (getint(&str,node))
  575.         {
  576.             if (strnicmp(str,"ALL",3)) return (0);
  577.             *zone=*net=*node=-1;
  578.             return 10;
  579.         }
  580.         if (!*str) return (retcode);
  581.         if (*str=='.') goto pnt;
  582.         retcode++;
  583.         if (*str==':') {
  584.            str++;
  585.            *zone=*node;
  586.            *node=-1;
  587.            if (!*str) return (0);
  588.            if (getint(&str,node))
  589.            {
  590.               if (strnicmp(str,"ALL",3)) return (0);
  591.               *net=*node=-1;
  592.               return 10;
  593.            }
  594.            retcode++;
  595.         }
  596.         if (*str!='/') return (0);
  597.         str++;
  598.         *net=*node;
  599.         *node=alias[0].node;
  600.         if (getint(&str,node))
  601.         {
  602.             if (strnicmp(str,"ALL",3)) return (0);
  603.             *node=-1;
  604.             return 10;
  605.         }
  606.         if (*str=='.') goto pnt;
  607.         return (retcode);
  608. pnt:    str++;
  609.         if (getint(&str,point))
  610.         {
  611.             if (strnicmp(str,"ALL",3)) return (0);
  612.             *point=-1;
  613.             return 10;
  614.         }
  615.         return (4+retcode);
  616. }
  617.  
  618. /* utils funcs for config */
  619.  
  620. char *skip_blanks(char *string)
  621. {
  622.     while (*string && isspace(*string)) ++string;
  623.     return string;
  624. }
  625.  
  626. char *skip_to_blank(char *string)
  627. {
  628.         while (*string && !isspace(*string)) ++string;
  629.         return string;
  630. }
  631.  
  632. void ctl_string(char *copy, char *string)
  633. {
  634.     char *p;
  635.     p=skip_blanks(string);
  636.     strcpy(copy,p);
  637. }
  638.  
  639. void ctl_path(char *copy, char *str)
  640. {
  641.     char *q;
  642.     
  643.     str= skip_blanks(str);
  644.     for (q=str; *q && !isspace(*q); q++) ;
  645.     *q= '\0';
  646.     addslash(q);
  647.     ctl_string(copy, str);
  648. }
  649.  
  650. void ctl_file(char *copy, char *str)
  651. {
  652.     char *q;
  653.     
  654.     str= skip_blanks(str);
  655.     for (q=str; *q && !isspace(*q); q++) ;
  656.     *q= '\0';
  657.     ctl_string(copy, str);
  658. }
  659.  
  660. /* =============================================== CONFIG ACCESS */
  661.  
  662. BFIXPERM *get_perms(void )
  663. {
  664.     return cfg_perms;
  665. }
  666.  
  667. BFIXPERM *get_fperms(void )
  668. {
  669.     return cfg_fperms;
  670. }
  671.  
  672. BTCKANN *get_announce(void )
  673. {
  674.     return cfg_announce;
  675. }
  676.  
  677. /* get outbound file name */
  678.  
  679. int get_out_fname(char *outdir,int zone, int net, int node, int point)
  680. {
  681.     char fileroot[BBSSTR];
  682.     int i,got_it=0;
  683.     
  684.     if(point!=0)
  685.     {
  686.         for (i=0; i < nalias; i++)
  687.         {
  688.             if (alias[i].zone==zone && alias[i].net==net &&
  689.                alias[i].node==node && alias[i].point==0)
  690.             {
  691.                 net= alias[i].pointnet;
  692.                 node= point;
  693.                 point= 0;
  694.                 got_it++;
  695.                 break;
  696.             }
  697.         }
  698.         if(!got_it)
  699.         {
  700.             logline(3,"Can't find %d:%d/%d.%d fakenet!",zone,net,node,point);
  701.             return BBSFAIL;
  702.         }
  703.     }
  704.     
  705.     if(cfg_binkley) /* binkley outbound */
  706.     {
  707.         if(zone!=alias[0].zone)
  708.             sprintf(outdir,"%s%c%4x%4x.HLO",get_outbound(),SYSSEPAR,
  709.                                 net,node);
  710.         else
  711.             sprintf(outdir,"%s.%3x%c%4x%4x.HLO",get_outbound(),zone,SYSSEPAR,
  712.                                 net,node);
  713.     }
  714.     else
  715.     { /* thebox outbound */
  716.         strcpy(outdir,get_outbound());
  717.         put36(fileroot,zone,2);
  718.         put36(fileroot+2,net,3);
  719.         put36(fileroot+5,node,3);
  720.         strcat(fileroot,".HF");
  721.         strcat(outdir,fileroot);
  722.     }
  723.     return BBSOK;
  724. }
  725.  
  726. /* utility for above func, by Jac Kersing */
  727.  
  728. void put36(char *s, unsigned int n, int len)
  729. {
  730.     s += len;    /* Get to end of string! */
  731.     *s-- = 0;    /* Null terminate */
  732.     while(len--)
  733.     {
  734.         int d = n % 36;                /* Remainder */
  735.         n /= 36;
  736.         if(d < 10)
  737.             *s-- = d + '0';
  738.         else
  739.             *s-- = d - 10 + 'A';
  740.     }
  741. }
  742.  
  743. /* get password */
  744.  
  745. void get_password(char *passwd,int zone, int net,int node,int point)
  746. {
  747.     int i;
  748.     BPASSWORD *pw;
  749.     
  750.     pw=cfg_pwd->next;
  751.     
  752.     if (point)
  753.     {
  754.         for (i=0; i < nalias; i++)
  755.         {
  756.             if (alias[i].zone==zone && alias[i].net==net &&
  757.                 alias[i].node==node && alias[i].point==0)
  758.             {
  759.                 net= alias[i].pointnet;
  760.                 node= point;
  761.                 point= 0;
  762.                 break;
  763.             }
  764.         }
  765.     }
  766.   
  767.     while (pw!=NULL)
  768.     {
  769.        /* no match at all.. (yet) */
  770.         if ( (pw->zone==zone) &&
  771.        /* zone numbers match, now net */
  772.             (pw->net==net) &&
  773.        /* zone and net match.. node also? */
  774.             (pw->node==node) &&
  775.        /* and how about point */
  776.                (pw->point==point))
  777.         {
  778.                 strcpy(passwd,pw->passw);
  779.                 return;
  780.         }
  781.         pw=pw->next;
  782.     }
  783.     *passwd= '\0';
  784. }
  785.  
  786. /* find our address */
  787.  
  788. void get_ouraddress(FIDONODE *us, int zone, int net, int node, int point)
  789. {
  790.     int i;
  791.     BPASSWORD *pw;
  792.     
  793.     pw=cfg_pwd->next;
  794.     
  795.     if (point)
  796.     {
  797.         for (i=0; i < nalias; i++)
  798.         {
  799.             if (alias[i].zone==zone && alias[i].net==net &&
  800.                alias[i].node==node && alias[i].point==0)
  801.             {
  802.                 net= alias[i].pointnet;
  803.                 node= point;
  804.                 point= 0;
  805.                 break;
  806.             }
  807.         }
  808.     }
  809.  
  810.     while (pw!=NULL)
  811.     {
  812.        /* no match at all.. (yet) */
  813.         if ((pw->zone==-1 || pw->zone==zone) &&
  814.        /* zone numbers match, now net */
  815.            (pw->net==-1 || pw->net==net) &&
  816.        /* zone and net match.. node also? */
  817.            (pw->node==-1 || pw->node==node) &&
  818.        /* and how about point */
  819.            (pw->point==-1 || pw->point==point))
  820.         {
  821.                 us->zone=alias[pw->my_aka].zone;
  822.                 us->net=alias[pw->my_aka].net;
  823.                 us->node=alias[pw->my_aka].node;
  824.                 us->point=alias[pw->my_aka].point;
  825.                 return;
  826.         }
  827.         pw=pw->next;
  828.     }
  829.     us->zone=alias[0].zone;
  830.     us->net=alias[0].net;
  831.     us->node=alias[0].node;
  832.     us->point=alias[0].point;
  833.  
  834. }
  835.  
  836. /* strings */
  837.  
  838. char *get_netmail(void )
  839. {
  840.     return cfg_netpath;
  841. }
  842.  
  843. char *get_inbound(void )
  844. {
  845.     return cfg_mailpath;
  846. }
  847.  
  848. char *get_outbound(void )
  849. {
  850.     if(cfg_binkley)
  851.         return cfg_holdbink;
  852.     return cfg_hold;
  853. }
  854.  
  855. char *get_sysop(void )
  856. {
  857.     return cfg_sysop;
  858. }
  859.  
  860. char *get_ticktemp(void)
  861. {
  862.     return cfg_temp;
  863. }
  864.  
  865. /**/